-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fix UnobservedTaskException from SemaphoreSlim.WaitAsync #60890
Conversation
Tagging subscribers to this area: @dotnet/area-system-threading-tasks Issue DetailsIf a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed. Fixes #60856
|
If a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed.
743ca48
to
404649c
Compare
@stephentoub should we backport it to 6.0.1? |
It'd be fine to propose doing so if you think it's worthwhile. |
I think that it's worthwhile. It's quite common to use |
It should be low risk; it's just setting a flag that says "treat this as already observed". We could let it bake in main for a bit first if desired, or not. |
/backport to release/6.0 |
Started backporting to release/6.0: https://github.com/dotnet/runtime/actions/runs/1451429820 |
If a SemaphoreSlim.WaitAsync times out, it correctly returns false, but it also results in TaskScheduler.UnobservedTaskException being raised unexpectedly, due to internal use of a faulted task whose exception isn't observed. This fixes that by marking any such exceptions as having been observed.
Fixes #60856